﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using CFSystem.JXC.Model;
using CFSystem.JXC.IDAL;
using CFSystem.JXC.DALFactory;
using CFSystem.JXC.AccessDAL;

namespace CFSystem.JXC.BLL
{
   public class ProdCatergory
    {
           // Get an instance of the Category DAL using the DALFactory
        // Making this static will cache the DAL instance after the initial load
        private static readonly IProdCatergory dal = DALFactory.DataAccess.CreateProdCatergory();

        public ProdCatergory()
        { }
        /// <summary>
        /// Method to get all categories
        /// </summary>										
        /// <returns>Generic List of CategoryInfo</returns>	   		
        public IList<ProdCatergoryInfo> GetProdCatergorys()
        {
            return dal.GetProdCatergorys();
        }
        
         /// <summary>
         /// insert ProdCatergory into db.
         /// </summary>
         /// <param name="ProdCatergoryName"></param>
        public void Insert(string parentName, string name)
        {
            //check name
            
            //insert
            dal.InsertProdCatergory(parentName,name);
        }

        /// <summary>
        /// 
        /// </summary>
        /// <param name="ProdCatergoryID"></param>
        public void Delete(int ProdCatergoryID)
        {
            dal.DelProdCatergoryByID(ProdCatergoryID);
        }

        /// <summary>
        /// 
        /// </summary>
        /// <param name="ProdCatergoryID"></param>
        /// <param name="updValue"></param>
        public void Update(int ProdCatergoryID, string name, string parentName)
        {
            dal.UpdateProdCatergoryByID(ProdCatergoryID,name,parentName);
        }
       /// <summary>
       /// 
       /// </summary>
       /// <param name="name"></param>
       /// <param name="parentName"></param>
       /// <returns></returns>
        public bool IsExists(string name, string parentName)
        {
           return dal.IsExists(name, parentName);
        }
       /// <summary>
       /// 
       /// </summary>
       /// <returns></returns>
        public IList<string> GetAllCatergoryList()
        {
            return dal.GetAllCatergoryList();
        }
    }
}
